package com.jiguang.property.controller;


import com.jiguang.property.annotation.Log;
import com.jiguang.property.dto.BuildInfoDTO;
import com.jiguang.property.dto.HostelInfoDTO;
import com.jiguang.property.entity.HostelInfo;
import com.jiguang.property.service.HostelInfoService;
import com.jiguang.property.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2025-03-15
 */
@RestController
@RequestMapping("/hostel")
public class HostelInfoController {
    @Autowired
    private HostelInfoService hostelInfoService;

    @ApiOperation(value = "获取房屋信息列表")
    @PostMapping("list")
    @Log(name = "查询房屋信息列表")
    public Result list(@RequestBody HostelInfoDTO hostelInfoDTO) {
        return hostelInfoService.listHostelInfo(hostelInfoDTO);
    }

    @ApiOperation(value = "通过ID删除房屋信息")
    @PostMapping("delete")
    @Log(name = "删除房屋列表")
    public Result delete(String hostelIds) {
        return hostelInfoService.deleteHostelInfo(hostelIds);
    }

    @ApiOperation(value = "编辑房屋信息")
    @PostMapping("saveOrUpdate")
    @Log(name = "操作房屋信息")
    public Result updateOrAdd(@RequestBody HostelInfoDTO hostelInfoDTO) {
        return hostelInfoService.updateOrAddHostelInfo(hostelInfoDTO);
    }
}

